package nl.hva.web.mvcwebapp.models;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;

/**
 *
 * @author Thijs
 */
@Entity
@Table(name = "user")
public class User implements Serializable {

        private int userId;
        private int userType;
        private String userName;
        private String password;
        private String password2;
        private String userFirstName;
        private String userLastName;
        private String userEmail;
        private String userLandOfOrigin;
        private String profilepicture;
        private String isteacher;
    private Set<CourseUser> courseUser = new HashSet<CourseUser>();

    public User() {
    }

    public User(int userId, int userType, String userName, String password, String userFirstName,
            String userLastName, String userEmail, String userLandOfOrigin, String profilepicture) {
        this.userId = userId;
        this.userType = userType;
        this.userName = userName;
        this.password = password;
        this.userFirstName = userFirstName;
        this.userLastName = userLastName;
        this.userEmail = userEmail;
        this.userLandOfOrigin = userLandOfOrigin;
        this.profilepicture = profilepicture;
    }

    /* Getters en setters voor de verschillende attributen van het Model */
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Column(name = "email")
    public String getUserEmail() {
        return userEmail;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    @Column(name = "firstname")
    public String getUserFirstName() {
        return userFirstName;
    }

    public void setUserFirstName(String userFirstName) {
        this.userFirstName = userFirstName;
    }

    @Id
    @GeneratedValue
    @Column(name = "id")
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Column(name = "landOfOrigin")
    public String getUserLandOfOrigin() {
        return userLandOfOrigin;
    }

    public void setUserLandOfOrigin(String userLandOfOrigin) {
        this.userLandOfOrigin = userLandOfOrigin;
    }

    @Column(name = "lastname")
    public String getUserLastName() {
        return userLastName;
    }

    public void setUserLastName(String userLastName) {
        this.userLastName = userLastName;
    }

    @Column(name = "username")
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Column(name = "soortuser")
    public int getUserType() {
        return userType;
    }

    public void setUserType(int userType) {
        this.userType = userType;
    }

    /**
     * @return the profilepicture
     */
    @Column(name = "profilepicture")
    public String getProfilepicture() {
        return profilepicture;
    }

    /**
     * @param profilepicture the profilepicture to set
     */
    public void setProfilepicture(String profilepicture) {
        this.profilepicture = profilepicture;
    }

    /**
     * @return the password2
     */
    @Column(name = "password2")
    public String getPassword2() {
        return password2;
    }

    /**
     * @param password2 the password2 to set
     */
    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    /**
     * @return the course
     */
    /**
     * @return the isteacher
     */
    @Column(name = "isteacher")
    public String getIsteacher() {
        return isteacher;
    }

    /**
     * @param isteacher the isteacher to set
     */
    public void setIsteacher(String isteacher) {
        this.isteacher = isteacher;
    }

    /**
     * @return the courseUser
     */
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "pk.user", cascade = CascadeType.ALL)
    public Set<CourseUser> getCourseUser() {
        return courseUser;
    }

    /**
     * @param courseUser the courseUser to set
     */
    public void setCourseUser(Set<CourseUser> courseUser) {
        this.courseUser = courseUser;
    }
    /**
     * @return the teachers
     */
}
